package com.example.cshaoshao.demo.entities;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by cshaoshao on 2017/6/25.
 */

public class ManagerNet
{
    public void setCallback(CallBack callback) {
        this.callback = callback;
    }

    private CallBack callback;
    private List<String >list=new ArrayList<>();
    public void loadData()
    {
        new Thread(new Runnable() {
            @Override
            public void run()
            {
                try
                {
                    for (int i = 'a'; i <'z' ; i++)
                    {
                        list.add(String.valueOf(i));
                    }
                    if(callback!=null)
                    callback.successLoad(list);
                }
                catch (Exception e)
                {
                    e.printStackTrace();
                    if(callback!=null)
                    {
                        callback.failLoad(e.getMessage());
                    }
                }

            }
        }).start();
    }
    public interface CallBack
    {
        public void successLoad(List<String> list);
        public void failLoad(String e);
    }

}
